<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<div class="m15">
	<c:set var="totalMoney" value="0"></c:set>
	<c:set var="cartLength" value="0"></c:set>
	<table cellpadding="0" cellspacing="0" class="tablelist mt15">
    	<tr>
           <th>购物车中的商品</th>
           <th width="10%">单价</th>
           <th width="20%">购买数量</th>
           <th width="15%">金额小计</th>
           <th width="7%">操作</th>
        </tr>
        <c:choose>
       		<c:when test="${not empty OrderItemList}">
       			<c:forEach items="${OrderItemList}" var="item" varStatus="v">
        			<tr <c:if test="${v.count % 2 == 0}">class="trbg"</c:if>>
        				<input name="itemId" value="${item.id }" type="hidden" />
			            <td class="left"><a  target="_blank" href="mall/product/view/${item.id }">${item.productName }</a></td>
			            <td>￥<fmt:formatNumber value="${item.price / 100.0}" pattern="#0.00" />元</td>
			            <td><input type="button" class="btn_cart" value="─" id="un_${item.id }" /><input type="text" class="text_cart" value="${item.productNum }" id="${item.id }" maxlength="1" /><input type="button" class="btn_cart" value="＋" id="up_${item.id }" /></td>
			            <td>￥<fmt:formatNumber value="${item.price * item.productNum / 100.0}" pattern="#0.00" />元</td>
			            <td><i id="del_${item.id }" class="i_e" title="删除"></i></td>
		          	</tr>
		          	<c:set var="totalMoney" value="${totalMoney + (item.price * item.productNum / 100.0)}"></c:set>
       			</c:forEach>
       			<c:set var="cartLength" value="${fn:length(OrderItemList) }"></c:set>
       		</c:when>
       		<c:otherwise>
       			<tr><td colspan="6"><div class="didnot">貌似您的购物车空空的，去挑选喜欢的商品吧！<a href="userIndex_list.action">挑选&gt;&gt;</a></div></td></tr>
       		</c:otherwise>
        </c:choose>
        <input id="cartLength" value="${cartLength }" type="hidden" />
	</table>
</div>
<c:if test="${not empty OrderItemList}">
     <div class="mall_settlement">
     	<div class="clear_list"><a href="javascript:void(0);" class="aa" id="btn_clear_cart"><i class="i_m"></i> 清空购物车</a></div>
       	<span class="f14 clrg fb">${fn:length(OrderItemList) }</span>件商品金额总计：<span class="f22 clrg fb mr10">￥<fmt:formatNumber value="${totalMoney}" pattern="#0.00" /></span>
       	<span class="clre mlr10">|</span><span class="f14 mr10"><a href="userIndex_list.action">继续购物</a></span>
       	<input type="button" class="btnd_a fb" value="去结算" id ="orderSubmit" onclick="toSubmit()" />
     </div>
    
     <script type="text/javascript" src="ipiinclude/ipijs/user/mall/cart_list.js"></script>
</c:if>
